<?php

namespace Database\Factories;

use App\Models\Domain;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;

class DomainFactory extends Factory {
	protected $model = Domain::class;

	public function definition() {
		$reg_at = $this->faker->dateTimeBetween( '2020-01-01', 'now');//返回指定时间区间的DateTime对象，可选时区
		$reg_at= Carbon::parse($reg_at);
		$end_at =  Carbon::parse( $reg_at )->addYears(1);

		return [
			//'domain' => $this->faker->domainName,  //中文下无法使用
			'domain'   => $this->faker->unique()->lexify( str_repeat( '?', rand( 4, 8 ) ) ) . '.com',
			'price'    => $this->faker->randomNumber( 3 ),
			'city'     => $this->faker->city,
			'provider' => $this->faker->randomElement( [ '阿里云', '腾讯云', '华为云','景安','西部数码','百度云','美橙互联','其他' ] ),
			'icp_name' => $this->faker->company,
			'icp_type' => rand( 0, 4 ),
			'status'   => rand( 0, 1 ),
			'reg_at'   => $reg_at,
			'end_at'   => $end_at,
			//    'end_at' =>$reg_at->subYear()->toDateTime(),
			//  'email_verified_at' => now(),
			//  'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
			//  'remember_token' => Str::random(10),
		];
		//      namespace App\Models\DomainInduce
		//      DomainInduce::factory()->count(3)->create()
	}
}
